package com.fivefu.core.skyeye.event.controller;

import com.fivefu.base.web.controller.BaseController;
import com.fivefu.base.web.vo.ResultInfo;
import com.fivefu.core.skyeye.event.services.SyncRedisStreamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * redis队列消息读取 前端控制器
 * </p>
 *
 * @author 
 * @since 2022-08-26 15:20:28
 */
@Api(tags = "redis消息队列读取")
@RestController
@RequestMapping("/aiRedisStream")
public class DbAiRedisStreamController extends BaseController {

    private static final Logger logger = LoggerFactory.getLogger(DbAiRedisStreamController.class);

    @Autowired
    private SyncRedisStreamService syncRedisStreamService;

    @ApiOperation(value = "redis失败事件补录",httpMethod = "POST",response = ResultInfo.class,notes = "redis失败事件补录")
    @RequestMapping(path = "/supplementFailEvent",method = RequestMethod.POST)
    public ResultInfo supplementFailEvent() {
        try {
            syncRedisStreamService.supplementFailEvent();
            return ResultInfo.renderSuccess("redis失败事件补录成功");
        } catch (Exception e) {
            logger.error(e.getMessage(),e);
        }
        return   ResultInfo.renderError("redis失败事件补录失败");
    }

}
